import 'package:app_admin/pages/home/home_logic.dart';
import 'package:app_admin/pages/main/main_view.dart';
import 'package:app_admin/res/images.dart';
import 'package:app_admin/res/strings.dart';
import 'package:app_admin/res/styles.dart';
import 'package:app_admin/widgets/bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class HomePage extends StatelessWidget {
  final logic = Get.find<HomeLogic>();

  HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(() => Scaffold(
          backgroundColor: Styles.c_FFFFFF,
          body: IndexedStack(
            index: logic.index.value,
            children: [
              // ConversationPage(),
              // ContactsPage(),
              MainPage(),
            ],
          ),
          bottomNavigationBar: BottomBar(
            index: logic.index.value,
            items: [
              BottomBarItem(
                selectedImgRes: ImageRes.homeTab1Sel,
                unselectedImgRes: ImageRes.homeTab1Nor,
                label: StrRes.home,
                imgWidth: 28.w,
                imgHeight: 28.h,
                onClick: logic.switchTab,
                //onDoubleClick: logic.scrollToUnreadMessage,
                //count: logic.unreadMsgCount.value,
              ),
              BottomBarItem(
                selectedImgRes: ImageRes.homeTab2Sel,
                unselectedImgRes: ImageRes.homeTab2Nor,
                label: StrRes.contacts,
                imgWidth: 28.w,
                imgHeight: 28.h,
                onClick: logic.switchTab,
                //count: logic.unhandledCount.value,
              ),
              BottomBarItem(
                selectedImgRes: ImageRes.homeTab4Sel,
                unselectedImgRes: ImageRes.homeTab4Nor,
                label: StrRes.mine,
                imgWidth: 28.w,
                imgHeight: 28.h,
                onClick: logic.switchTab,
              ),
            ],
          ),
        ));
  }
}
